/**
 * Copyright (C) 2018-2022
 * All rights reserved, Designed By www.yixiang.co
 */
package co.yixiang.yshop.framework.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * @author hupeng
 * 订单相关枚举
 */
@Getter
@AllArgsConstructor
public enum OrderInfoEnum {

    STATUS_APPLY_REFUND(-1, "申请退款"),
    STATUS_REFUND_SUCCESS(-2, "退款成功"),
    STATUS_GROUP_FAILURE(-4, "成团失败"),

    STATUS_DEFAULT(0, "默认"),
    STATUS_WAIT_RECEIVED(1, "待收货"),
    STATUS_RECEIVED(2, "已收货"),
    STATUS_FINISHED(3, "已完成"),
    STATUS_CANCEL(4, "取消"),
    STATUS_WAIT_GROUP(5, "待成团"),

    PAY_STATUS_UNPAID(0, "未支付"),
    PAY_STATUS_HAVE_PAID(1, "已支付"),

    REFUND_STATUS_NORMAL(0, "正常"),
    REFUND_STATUS_BEING_REFUNDED(1, "退款中"),
    REFUND_STATUS_HAVE_REFUNDED(2, "已退款"),

    BARGAIN_STATUS_ONGOING(1, "参与中"),
    BARGAIN_STATUS_FAIL(2, "参与失败"),
    BARGAIN_STATUS_SUCCESS(3, "参与成功"),

    PINK_STATUS_ONGOING(1, "进行中"),
    PINK_STATUS_FINISHED(2, "已完成"),
    PINK_STATUS_UNFINISHED(3, "未完成"),

    PINK_REFUND_STATUS_NORMAL(0, "拼团正常"),
    PINK_REFUND_STATUS_REFUNDED(1, "拼团已退款"),

    CANCEL_STATUS_NORMAL(0, "正常"),
    CANCEL_STATUS_CANCELED(1, "已取消"),

    CONFIRM_STATUS_NORMAL(0, "正常"),
    CONFIRM_STATUS_CONFIRM(1, "确认"),

    PAY_CHANNEL_PUBLIC_ACCOUNT_H5(0, "公众号/H5支付渠道"),
    PAY_CHANNEL_MINI_PROGRAM(1, "小程序支付渠道"),


    NO(0, "否"),
    YES(1, "是"),

    SHIPPING_TYPE_DELIVERY(1, "快递"),
    SHIPPING_TYPE_STORE_PICKUP(2, "门店自提"),

    UNABLE_AFTER_SALES(0, "不能售后"),
    ABLE_AFTER_SALES(1, "能售后"),

    CAMPAIGN_ORDER(2, "活动订单");


    private final Integer value;
    private final String desc;

    public static OrderInfoEnum toType(int value) {
        return Stream.of(OrderInfoEnum.values())
                .filter(p -> p.value == value)
                .findAny()
                .orElse(null);
    }


}
